import request from '@/router/axios';
import {baseUrl} from "@/config/env";

export const toAudit = (row) => {
  return request({
    url: baseUrl + '/api-bureau/minorAccident/manager/toAudit',
    method: 'post',
    data: row
  })
}

export const getPage = (current, size, params) => {
  return request({
    url: baseUrl + '/api-bureau/minorAccident/manager/toAudit',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const menuButtonTree = () => {
  return request({
    url: baseUrl + '/api-user/menus/menuButtonTree',
    method: 'get',
    // data: row
  })
}

export const grant = (roleIds, menuIds, dataScopeIds) => {
  return request({
    url: baseUrl + '/api-user/menus/granted',
    method: 'post',
    data: {
      roleId: roleIds[0],
      menuIds,
      dataScopeIds
    }
  })
}

export const remove = (ids) => {
  return request({
    url: baseUrl + '/api-user/roles/remove/'+ids,
    method: 'post',
    // params: {
    //   ids,
    // }
  })
}

export const create = (row) => {
  return request({
    url: baseUrl + '/api-user/roles/create',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: baseUrl + '/api-user/roles/update',
    method: 'post',
    data: row
  })
}


export const selectedMenuByRoleId = (roleIds) => {
  return request({
    url: baseUrl + '/api-user/menus/selectedMenuByRoleId',
    method: 'get',
    params: {
      roleId: roleIds,
    }
  })
}
